- storing ||= f.object
- variant = Maybe(storing.parcel_item.variant)
- storage_name = storing.storage.name if storing.storage

.nested-fields.storing-fields
  %input.hidden{data: { 'when-item': 'name', 'when-set-value': 'RECORD_VALUE', 'when-scope': 'storage'}, value: storage_name}
  .remove-action-container
    .nested-remove.act
      - if f.object.destroyable?
        = link_to_remove_association(content_tag(:i) + h(:destroy.tl), f, 'data-no-turbolink' => true, class: 'destroy remove remove-item')
  .storing-calculation
    .storing-conditionning
      = f.input :conditionning, wrapper: :conditionning_append do
        = f.input_field :conditionning , class: "conditionning", data: { trade_component: 'conditionning', "when-item": "unitary", "when-set-value": 1, "when-prop-value": "disabled", 'when-scope': 'target' }
        %span.add-on.storage-unit-name{data: { 'when-item': 'unit_name', 'when-set-value': 'RECORD_VALUE', 'when-scope': 'target'}}
          = variant.unit_name.or_else('unité')
    %div.control-group.multiplicator X
    .storing-conditionning-quantity.storing-conditionning-quantity--merchandise
      = f.input :conditionning_quantity, wrapper: :conditionning_append do
        = f.input_field :conditionning_quantity , class: "conditionning-quantity", data: { trade_component: 'conditionning_quantity', "when-item": "unitary", "when-set-value": 1, "when-prop-value": "disabled", 'when-scope': 'target' }
    %div.control-group.equalizor= "="
    .storing-quantifier
      = f.input :quantity, wrapper: :append do
        = f.input_field :quantity, class: 'storing-quantity', placeholder: '0', data: { "when-item": "unitary", "when-set-value": 1, "when-prop-value": "disabled", required: true, 'when-scope': 'target' }
        %span.add-on.storage-unit-name{data: { 'when-item': 'unit_name', 'when-set-value': 'RECORD_VALUE', 'when-scope': 'target'}}
          = variant.unit_name.or_else('unité')


  .storing-area
    = f.label :storage.tl, class: "control-label", required: true
    = f.referenced_association :storage, source: :storage, label: false, new: false, input_html: { class: "parcel-item-storage", data: { product_of_delivery_item: { url: backend_product_path("RECORD_ID", format: :json), scope: 'storage' }, required: true } }

  %div.current-stock
    .merchandise-current-stock
      %span.stock-label= :current_stock.tl
      %span.stock-value= variant.current_stock_per_storage(storing.storage).or_else(0)
      %span.stock-unit= variant.unit_name.or_else("")

    .merchandise-stock-after-reception
      %span.stock-label= :stock_after_order.tl
      %span.stock-value= f.object.decorate.merchandise_stock_after_reception(variant.current_stock_per_storage(storing.storage).or_else(0))
      %span.stock-unit= f.object.decorate.merchandise_stock_unit(variant.unit_name.or_else(""))
